package com.corewillsoft.fireflies.app;

import android.app.Application;

import com.corewillsoft.fireflies.storage.DataAdapter;
import com.corewillsoft.fireflies.storage.DatabaseInitializer;
import com.corewillsoft.fireflies.util.DebugLog;
import com.corewillsoft.fireflies.util.DebugLog.Level;
import com.corewillsoft.fireflies.util.ScreenUtils;

public class GameApplication extends Application {

	@Override
	public void onCreate() {
		super.onCreate();
		ScreenUtils.initInstance(this);
		initLogging();
		initDatabase();
	}

	private void initLogging() {
		DebugLog.setEnabled(BuildConfiguration.LOGGING_ENABLED);
		DebugLog.setLevel(Level.Information);
		DebugLog.setEchoEnabled(BuildConfiguration.LOGGING_ENABLED);
		DebugLog.prepare(this);
	}

	private void initDatabase() {
		DataAdapter.initInstance(this);
		DatabaseInitializer databaseInitializer = new DatabaseInitializer(this);
		databaseInitializer.initDatabase();
	}
}
